appModule.component('nMeetingInfo', {
  templateUrl: 'components/meeting-info/meeting-info.template.html',

  controller: [
    '$scope',
    function($scope) {

      $scope.regName = {
        regVal : 'default',
        regNameList: [
          {name: 'default', tips: ''},
          {name: 'required', tips: '机构名称不能为空'},
          {name: 'maxLength', tips: '机构名称不能超过50个汉字'},
          {name: 'pass', tips: '√'}
        ]
      };
      $scope.regAddress = {
        regVal : 'default',
        regAddressList: [
          {name: 'default', tips: ''},
          {name: 'required', tips: '联系地址不能为空'},
          {name: 'maxLength', tips: '联系地址不能超过100个汉字'},
          {name: 'pass', tips: '√'}
        ]
      };
      $scope.regIName = {
        regVal : 'default',
        regINameList: [
          {name: 'default', tips: ''},
          {name: 'required', tips: '联系人姓名不能为空'},
          {name: 'maxLength', tips: '联系人姓名不能超过6个汉字'},
          {name: 'pass', tips: '√'}
        ]
      };
      $scope.regIPhone = {
        regVal : 'default',
        regIPhoneList: [
          {name: 'default', tips: ''},
          {name: 'required', tips: '联系人电话不能为空'},
         {name: 'pattern', tips: '请输入正确的手机号码'},
          {name: 'pass', tips: '√'}
        ]
      };
      $scope.regIEmail = {
        regVal : 'default',
        regIEmailList: [
          {name: 'default', tips: ''},
          {name: 'required', tips: '联系人邮箱不能为空'},
          {name: 'pattern', tips: '请输入正确的邮箱'},
          {name: 'pass', tips: '√'}
        ]
      };

      $scope.change = function(reg,err){
        for(var attr in err){
          if(err[attr] == true){
            $scope[reg].regVal = attr;
            return;
          }
        }
        $scope[reg].regVal = 'pass';
      };


      /*添加联系人*/
      let IDContent = document.getElementById('IDContent');
      let addContent = document.getElementById('addContent');
      $scope.addContent = function(){
        IDContent.style.display = 'block';
        addContent.style.display = 'none';
      };
      $scope.delContent = function(){
        IDContent.style.display = 'none';
        addContent.style.display = 'inline-block';
      }

    },
  ]
});


